<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>修改项目联系人</title>

<script type="text/javascript">

	function findArea(elem){
		var provinceId = $(elem).val();
		$("#city option:not(:first)").remove();
		$("#city").val("");
		if (provinceId == "") {
			$("#s2id_city").find("a:first").find("span:first").html("请选择市区");
			return false;
		}
		
		$.ajax({
			type:"post",
			data:"parent_id="+provinceId,
			url:"${ctx}/crm/business/customer/findCity",
			success:function(data){
				for(var i=0;i<data.length;i++){
					var nodes = "<option value='"+data[i].id+"'>"+data[i].name+"</option>";
					$("#city").append(nodes);
				}
			}
		});
		$("#s2id_city").find("a:first").find("span:first").html("请选择市区");
	}

$(function(){
	$("#updateBase").submit(function(){
		var reg=/^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/;
		var website=$("#website").val();
		if(website!="http:\/\/"&&website!="https:\/\/"&&!reg.test(website)){
			$("#websiteMsg").css("color","red");
		return false;
		}
		if(website=="http:\/\/"||website=="https:\/\/"){
			$("#website").val("");
		}
	});
})
</script>

<meta name="decorator" content="default" />

</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active">
			<a href="javascript:void(0)">修改基本信息</a>
		</li>

	</ul>
	<br />
	<form:form id="updateBase" modelAttribute="customer" action="${ctx}/crm/findcustomer/findCustomer/updateBase" method="post" class="form-horizontal">

		<form:input type="hidden" path="id" value="${id}" />
		<sys:message content="${message}" />
		<div class="control-group">
			<label class="control-label">公司名:</label>
			<div class="controls">
				<form:input path="name" id="name" name="name" maxlength="100" style="width:335px" />
				&nbsp;
				<label style="color: #888888">最多100个字符</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">选择地区：</label>
			<div class="controls">
				<form:select path="province" class="input-xlarge" id="province" style="width:165px;" onchange="findArea(this)">
					<form:option value="">请选择省份</form:option>
					<c:forEach items="${area}" var="area">
						<form:option value="${area.id}">${area.name}</form:option>
					</c:forEach>
				</form:select>&nbsp;&nbsp;&nbsp;&nbsp;
				<form:select path="city" class="input-xlarge" id="city" style="width:165px;">
					<form:option value="">请选择市区</form:option>
				</form:select>
				<span style="color: #888888"> 不选择则不会修改</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">公司简介:</label>
			<div class="controls">
				<form:textarea path="content" style="resize:none;width:700px;height:200px;" maxlength="500" />
				&nbsp;
				<label style="color: #888888"> 最多500个字符</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">公司网站：</label>
			<div class="controls">
			<c:if test="${customer.website==''}">
				<form:input id="website" value="http://" path="website" htmlEscape="false" maxlength="150" class="input-xlarge " style="width:335px;" />
			</c:if>
			<c:if test="${customer.website!=''}">
				<form:input id="website" path="website" htmlEscape="false" maxlength="150" class="input-xlarge " style="width:335px;" />
			</c:if>
				<span id="websiteMsg"> 网站格式如：http://www.baidu.com</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">意向状态</label>
			<div class="controls">
				<form:select path="statusId" style="width:180px;">
					<form:option value="">请选择</form:option>
					<form:option value="暂无意向">暂无意向</form:option>
					<form:option value="意向客户">意向客户</form:option>
				</form:select>
			</div>
		</div>
		<div class="form-actions">
			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存" />
			<input id="btnCancel" class="btn btn-primary" type="button" value="返 回" onclick="history.go(-1)" />
		</div>
	</form:form>
</body>
</html>